package com.cennavi.funcs;

import org.apache.spark.api.java.function.PairFunction;

import scala.Tuple2;

/** * @author  作者 :allen
    * @date 创建时间：2017年9月19日 下午4:30:38 
    * @version 1.0 
    */

public class AddKeyPairFunction implements PairFunction<String, String, String> {

	private static final long serialVersionUID = 1L;

	public Tuple2<String, String> call(String t) throws Exception {
		String data_source = t;
		String[] data = data_source.split(",");
//		if(data.length < 5){
//			System.out.println("come in");
//			System.out.println(data_source);
//		}
		String key = data[0] + "_" + data[4];
		
		return new Tuple2<String, String>(key, data_source);
	}

}
